<?php

/// http://www.dixieandtheninjas.net/hellounderscoreworld/testing/test_sql_join


class Test_sql_join extends CI_Controller {

	public function __construct() {
            parent::__construct(); 

            
	}
        
        public function index() {
            
            //$my_family = $_SESSION['active_family'];
            $my_family = '16';
            
            
$sql_server = 'test1.dixieandtheninjas.net';
$sql_db = 'hellounderscoreworld_db';
$sql_username = 'dbuserjermgame';
$sql_password = 'bridge876';

echo "Testing! </br>";

//////////////////////////////
$db = mysql_connect("$sql_server", "$sql_username", "$sql_password") or die ("Error connecting to database.");
    mysql_select_db("$sql_db", $db) or die ("Couldn't select the database.");
    
    $result = mysql_query("SELECT * FROM mail_msgs",$db);
    $rowcheck = mysql_num_rows($result);
    
    while ($row = mysql_fetch_assoc($result)){
    foreach ($row as $col => $val){
            //if ($col == 'name') {
            //    $leaders['name'][$i] = $val;
            //}
        //echo $val;
    }
    }
    
    /////////////////////
    //$result = mysql_query("SELECT * FROM mail_msgs",$db);
    echo "?, mID, to, read, txt, from, time, turn, import, type</br>";
    $result = mysql_query("
        SELECT *
        FROM mail_links a
        INNER JOIN mail_msgs b
        ON a.msg_id = b.id
        WHERE a.to_user = '16'
        ",$db);
    while ($row = mysql_fetch_assoc($result)){
    foreach ($row as $col => $val){
        echo $val;
        echo ", ";
    }
    echo "</br>";
    }
    
            
            
            
        }
        }









/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
?>
